package AbstractTransactions

import (
	"PaySalary/DataBase"
	"PaySalary/Model"
	"PaySalary/ModelImplementation"
)


type GetMethod interface {
	GetClassification() Model.PaymentClassification
	GetSchedule() Model.PaymentSchedule
}

type AddEmployeeTransaction struct {
	GetMethod
	itsEmployeeId int
	itsName string
	itsAddress string
}

func (add *AddEmployeeTransaction)NewAddEmployeeTransaction(EmployeeId int ,name string, address string)  {
	add.itsEmployeeId = EmployeeId
	add.itsName = name
	add.itsAddress = address
}

func (add *AddEmployeeTransaction) Execute() {
	pc := add.GetClassification()
	ps := add.GetSchedule()
	pm := ModelImplementation.HoldMethod{}
	e := Model.NewEmployee(add.itsEmployeeId,add.itsName,add.itsAddress)

	e.SetItsClassification(pc)
	e.SetItsSchedule(ps)
	e.SetItsPaymentMethod(pm)

	DataBase.PayrollDatabase.AddEmployee(e.GetEmployeeId(),e)
}
